package com.geostar.constructionland.statistics.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author zhu jiacheng
 * @date 2020/8/20 17:51
 */
@RestController
public class StatusController {

    @GetMapping(path = "/status")
    public String status(HttpServletRequest httpRequest) throws UnknownHostException {
        String addr = InetAddress.getLocalHost().getHostAddress();
        int port = httpRequest.getLocalPort();
        return String.format("服务器地址: %s:%d", addr, port);
    }
}
